Upsert Seed Models for Provider
Used to create or update the seed models data for a specific AI provider. This endpoint allows you to add new models or update existing model specifications in the seed collection.
API Endpoint
| Property | Value |
|---|---|
| Request Method | POST |
| Request URL | https://api.seliseblocks.com/models/seed/providers/{provider}/models |
Request
Request Example
curl -X POST 'https://api.seliseblocks.com/models/seed/providers/openai/models' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '[
{
"Model": "gpt-4-turbo-preview",
"ModelGoodName": "GPT-4 Turbo",
"MaxTokens": 4096,
"DefaultTemp": 0.7,
"ContextLength": 128000,
"InputCostPerMillion": 10.0,
"OutputCostPerMillion": 30.0
},
{
"Model": "gpt-3.5-turbo",
"ModelGoodName": "GPT-3.5 Turbo",
"MaxTokens": 4096,
"DefaultTemp": 0.7,
"ContextLength": 16385,
"InputCostPerMillion": 0.5,
"OutputCostPerMillion": 1.5
}
]'
Path Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| provider | string | Yes | Provider name (case-insensitive). Examples: "openai", "anthropic", "azure", "google". |
Request Headers
| Field | Type | Required | Description |
|---|---|---|---|
| accept | string | Yes | Accepted response format. Use application/json |
| Content-Type | application/json | Yes | Data type, must be application/json. |
Request Body
Request Body Schema
[
{
"Model": "string",
"ModelGoodName": "string",
"MaxTokens": 0,
"DefaultTemp": 0,
"ContextLength": 0,
"InputCostPerMillion": 0,
"OutputCostPerMillion": 0
}
]
Request Body Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| Model | string | Yes | Exact model identifier used in API calls (e.g., "gpt-4-turbo-preview"). |
| ModelGoodName | string | Yes | Human-readable display name for the model (e.g., "GPT-4 Turbo"). |
| MaxTokens | integer | Yes | Maximum number of tokens the model can generate in a single response. |
| DefaultTemp | number | Yes | Default temperature setting for the model (typically 0-2). |
| ContextLength | integer | Yes | Maximum context window size in tokens (input + output). |
| InputCostPerMillion | number | Yes | Cost per million input tokens in USD. |
| OutputCostPerMillion | number | Yes | Cost per million output tokens in USD. |
note
Upsert Behavior
This endpoint performs an upsert operation:
- Create: If a model with the given
Modelidentifier doesn't exist, it will be created - Update: If a model with the given
Modelidentifier already exists, it will be updated with the new values - Replace: The entire models array for the provider is replaced, so include all models you want to keep
Provider-Specific Considerations:
- Ensure model names match the exact identifiers used by the provider's API
- Cost values should reflect current pricing from the provider
- Context length should account for both input and output tokens
- Temperature ranges may vary by provider (most use 0-2, some use 0-1)
tip
Best practices for upserting seed models:
- Batch updates: Include all models in a single request to maintain consistency
- Accurate pricing: Regularly update cost information to reflect provider changes
- Version tracking: Use descriptive ModelGoodName values to differentiate versions
- Validation: Test model configurations after upserting
- Documentation: Keep records of when and why seed data was updated
Temperature guidelines by use case:
- 0.0-0.3: Factual, deterministic responses (documentation, data extraction)
- 0.4-0.7: Balanced creativity and consistency (general chat, Q&A)
- 0.8-1.0: Creative content (writing, brainstorming)
- 1.1-2.0: Highly experimental (not recommended for most use cases)
Cost calculation example:
- Input: 1M tokens at $10/M = $10.00
- Output: 500K tokens at $30/M = $15.00
- Total cost: $25.00 for the interaction
Response
Success Response (200 OK)
Returns an object confirming the upsert operation.
{
"success": true,
"provider": "openai",
"models_updated": 2,
"timestamp": "2025-01-12T10:30:00Z"
}
Response Fields
| Field | Type | Description |
|---|---|---|
| - | object | Flexible response object (additionalProp1: {}) containing operation details. Typically includes success status, provider name, and count of models updated. |
note
Response Object Structure
The actual response structure may vary but typically includes:
- Operation success status
- Provider name that was updated
- Number of models created or updated
- Timestamp of the operation
- Any warnings or validation messages
Error Response (422 Unprocessable Entity)
Returns validation error details when the request body is invalid or the provider doesn't exist.
{
"detail": [
{
"loc": [
"body",
0,
"MaxTokens"
],
"msg": "MaxTokens must be a positive integer",
"type": "value_error.number.not_gt"
}
]
}
Error Response Fields
| Field | Type | Description |
|---|---|---|
| detail | array | Array of validation error objects. |
| loc | array | Location of the error in the request (e.g., body, field index). |
| msg | string | Human-readable error message. |
| type | string | Error type identifier. |
Common Error Scenarios
| Error Type | Description | Resolution |
|---|---|---|
| Provider Not Found | The specified provider doesn't exist in the system | Create the provider first or verify provider name |
| Invalid Model Format | Model identifier contains invalid characters | Use alphanumeric characters, hyphens, and underscores only |
| Missing Required Field | One or more required fields are missing | Ensure all required fields are included in each model object |
| Invalid Number Range | MaxTokens, DefaultTemp, or costs are out of valid range | Check value constraints (e.g., DefaultTemp typically 0-2) |
| Duplicate Model Names | Multiple models with the same Model identifier | Ensure Model identifiers are unique within the array |
| Invalid Cost Values | Negative or non-numeric cost values | Provide valid positive numbers for cost fields |
Error Codes
| Status Code | Description | Response Type |
|---|---|---|
| 200 | OK - Models upserted successfully | Success |
| 400 | Bad Request - Invalid request format | Bad Request |
| 404 | Not Found - Provider doesn't exist | Not Found |
| 422 | Validation Error - Invalid model data | Unprocessable Entity |
| 500 | Internal Server Error - Failed to upsert models | Internal Server Error |
warning
Important Considerations
- This operation replaces the entire models array for the provider
- Always include all models you want to keep, not just new ones
- Upserted seed data affects all users and projects in the system
- Changes take effect immediately and impact model selection UI
- Incorrect pricing data can lead to inaccurate cost estimates
- Test thoroughly in a non-production environment first
- Keep audit logs of seed data changes
- Coordinate with team before modifying shared seed data
- Consider backwards compatibility when updating model identifiers
- Provider API changes may require seed data updates